import {getRoleAuths} from '@/service/permission'

export default function useRoleData() {
  const rolelist = ref([])
  const roleAuths = ref([])

  async function getRolelist() {
    const {flag, data = {}} = await getAllRoles()
    if (flag) {
      rolelist.value = data.records
    }

    
  }
  // 获取当前用户权限
  async function getCurRoleAuths(params) {
    const {flag, data} = await getRoleAuths(props.roleId)
    if (flag) {
      roleAuths.value = data
    }
  }

  return {
    roleAuths,
    getCurRoleAuths
  }
}